package com.situ.mall.base.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import java.io.Serializable;

import com.situ.mall.base.util.C;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

/**
 * <p>
 * 
 * </p>
 *
 * @author darling
 * @since 2023-03-20
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("t_member")
public class Member implements Serializable {

    private static final long serialVersionUID = 1L;

    public Member(String username, String password, String tel, Integer status, String code, LocalDateTime createtime) {
        this.username = username;
        this.password = password;
        this.tel = tel;
        this.status = status;
        this.code = code;
        this.createtime = createtime;
    }

    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    /**
     * 用户名
     */
    private String username;

    /**
     * 密码
     */
    private String password;

    /**
     * 联系方式
     */
    private String tel;

    /**
     * 性别
     */
    private String sex;

    /**
     * 昵称
     */
    private String nickname;

    /**
     * 状态[0正常,1停用]
     */
    private Integer status;

    /**
     * 会员ID（固定生成一个唯一个ID）
     */
    private String code;

    /**
     * 头像地址
     */
    private String avatar;

    /**
     * 注册时间
     */
    private LocalDateTime createtime;


    /**
     * 展示是否被冻结
     */
    @TableField(exist = false)
    private String freezeAndThaw;

    public String getFreezeAndThaw() {
        return C.SHOWS[status];
    }

    /**
     * 展示头像
     */
    @TableField(exist = false)
    private String imgPath;

    public String getImgPath(){
        return C.UPLOAD_PATH_PREFIX + avatar;
    }


}
